-
Notifications
You must be signed in to change notification settings - Fork 9.2k
feat(plugin): add experimental.session.compacting hook for pre-compaction context injection #5698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(plugin): add experimental.session.compacting hook for pre-compaction context injection #5698
Conversation
55c14e4 to
f418cd9
Compare
|
This is great! How would you recommend wiring it up with a slash command? |
|
This isn't a slash command - it's a plugin hook that fires whenever compaction happens (via Agreed |
|
I agree. I had this PR #4616 a while back but I like your solution better. |
|
Nice! Your PR adds the user-facing trigger, this one adds the plugin hook. They're complementary - with both merged, users could |
f418cd9 to
dde4a2f
Compare
|
Talked w/ Dax we will merge but mark as experimental for now |
|
@rekram1-node hell ya! what's the process for getting it out of experimental? I've been testing it and it works exactly how I'd hoped, so curious. |
|
Normally it's just that he likes to think about APIs more and when we release as experimental we get to different usecases surface that we didn't think about originally, helps the API be better when it's "official", like I imagine there are people who'd wanna override the instructions instead of just append and this hook doesnt support that but we prolly wouldn't want a brand new one |
…tion context injection (#5698) Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
Summary
Adds a
session.compactingplugin hook that fires before compaction starts, allowing plugins to append additional context to the compaction prompt.Use Case
The opencode-swarm-plugin uses multi-agent coordination with beads (issue tracker), Swarm Mail (agent communication), and semantic memory. When compaction happens, the generic prompt loses all swarm coordination state. This hook lets plugins inject:
Changes
packages/plugin/src/index.tssession.compactinghook typepackages/opencode/src/session/compaction.tspackages/web/src/content/docs/plugins.mdxHook Signature
Example Usage
Design Decisions
sessionID- plugins fetch their own state